package example.strategy;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class DoServiceMap {
    private Map<String, IService> iServiceMap = new HashMap<>();

    public DoServiceMap(List<IService> iServices) {
        iServices.forEach(iService -> iServiceMap.put(iService.getType(), iService));


        System.out.println("------***" + iServiceMap);
    }

    public IService getIServiceImpl(String type) {
        IService iService = iServiceMap.get(type);
        return iService;
    }
}
